<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
</head>
<body>

</body>
</html>
<?php 
	class Person{
		protected $name;
		protected $sex;
		public function __construct($name="Tom",$sex="男"){
			$this->name=$name;
			$this->sex=$sex;
		}
		public function getName(){
			return $this->name;
		}
		public function setName($name){
			$this->name=$name;
		}
		public function getSex(){
			return $this->sex;
		}
		public function setSex($sex){
			$this->sex=$sex;
		}		

		public function display(){
			echo "<br/>".$this->name."的性别是：".$this->sex;
		}
	}

	/**
	* 
	*/
	class Student extends Person
	{
		protected $school;

		public function __construct($name,$sex,$school)
		{
			parent::__construct($name,$sex);
			$this->school=$school;
		}		

		public function getSchool()
		{
			return $this->school;
		}
		public function setSchool($school)
		{
			$this->school=$school;
		}		
		public function study()
		{
			echo $this->getName()."在".$this->school."<br/>";
		}//class Student end


	}

	class Teacher extends Student
	{
		protected $wage;
		public function __construct($name,$school,$wage)
		{
			parent::__construct($name,$school);
			$this->wage = $wage;
		}
		public function getWage()
		{
			return $this->wage;
		}
		public function setWage($wage)
		{
			$this->wage=$wage;
		}	
		public function work()
		{
			echo $this->getName()."在".$this->getSchool()."教学，挣".$this->wage."工资<br/>";
		}
	}

	$stu1 = new Student("Tom","男","Neusoft");
	$stu1->study();

	$stu2 = new Student();
	$stu2->setName("Mary");
	$stu2->setSex("女");
	$stu2->setSchool("NST");
	$stu2->study();


	$tea1 = new Teacher();
	$tea1->setName("Curry");
	$tea1->setSchool("Neu");
	$tea1->setWage("10000");
	$tea1->work();

	$p1=new Person("Jane","女");
	$p1->display();
	$p1->setName("James");
	$p1->setSex("男");
	$p1->display();
	//m
	$p2=new Person();
	echo "<br>姓名是:".$p2->getName();
	echo "<br>性别是:".$p2->getSex();
	
?>